<script setup lang="ts">
import axios from 'axios';
import * as echarts from 'echarts';
import { onMounted, ref } from 'vue';
const barChart = ref<HTMLElement>();
const myChart1 = ref<any>();
// 绘制柱形图
function initBarEcharts() {
  axios.get("/admin/getImageType").then(res=>{
    myChart1.value.data=res.data
  })
  // @ts-ignore
  myChart1.value = echarts.init(barChart.value!);
  myChart1.value.setOption({
    title: {
      text: '影像类型',
      // subtext: 'Fake Data',
      left: 'center',
      textStyle:{
        fontWeight:"lighter"
      },
    },
    tooltip: {
      trigger: 'item'
    },
    legend: {
      orient: 'vertical',
      left: 'left'
    },
    series: [
      {
        name: '满意度',
        type: 'pie',
        radius: '50%',
        data: [
          { value: 1048, name: 'X线影像（透视影像）' },
          { value: 735, name: '超声影像' },
          { value: 580, name: 'CT影像（计算机断层扫描影像）' },
          { value: 484, name: '核磁共振影像（磁共振成像）' },
          { value: 484, name: 'PET影像（正电子发射断层成像）' },

        ],
        emphasis: {
          itemStyle: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: 'rgba(0, 0, 0, 0.5)'
          }
        }
      }
    ]
  });
}
onMounted(() => {
  initBarEcharts();
});
</script>

<template>
  <div ref="barChart" id="barChart" ></div>
</template>

<style scoped>
#barChart{
  background-color: #fff;
  width: 100%;
  height: 90%;
}

</style>